#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n, q;
  cin >> n >> q;

  vector<int> cnt(n + 1, 1); //每一种值出现的次数

  cnt[0] = 0;
  int now = 0;
  while (q--) {
    int x, y;
    cin >> x >> y;
    int sum = 0;
    for (int i = now; i <= x; i++) {
      sum += cnt[i];
      cnt[i] = 0;
    }
    cnt[y] += sum;
    now = max(now, x + 1); //更新now为x+1，因为x+1之前的所有值都被删除了
    cout << sum << endl;
  }
}
